<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
	    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	    <meta http-equiv="Cache-Control" content="no-siteapp">
	    <meta name="renderer" content="webkit">
	    <meta name="viewport" content="initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
	    <meta name="Keywords" content="">
	    <meta name="description" content="">
		<title>密码更改</title>
		<style>
			html {
	            -ms-text-size-adjust: 100%;
	            -webkit-text-size-adjust: 100%;
	            line-height: 1.6
	        }
	        
	        body {
	            -webkit-touch-callout: none;
	            font-family: -apple-system-font, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
	            background-color: #f3f3f3;
	            line-height: inherit;
	            margin: 0;
	            padding: 0;
	            
	        }
	        .form {
	        	padding-top: 20px;
	        }
	        .form-item {
	        	background-color: #FFFFFF;
	        	margin-bottom: 20px;
	        	padding: 10px 20px;
	        	display: flex;
	        	flex-wrap: wrap;
	        }
	        .form-label {
	        	width: 80px;
	        	height: 32px;line-height: 32px;padding:1px 1px;
	        	background-color: #ffffff;
	        }
	        .input-inline {
	        	width: 70%;
	        	font-size: 16px;font-family: "微软雅黑";padding:1px 1px;
	        }
	        .form-mid {
	        	line-height: 20px;
	        	font-size: 14px;
	        	color: #999;
	        }
	        input {
	        	width: 98%;
	        	height: 32px;
	        	border: none;
	        	outline: none;
	        }
	        #btn {
	        	margin: 30px 20px;
	        	padding: 0;
	        	border-radius: 5px;
	        }
	        a {
	        	display: inline-block;
	        	text-decoration: none;
	        	width: 100%;
	        	border-radius: 5px;
	        	height: 52px;
	        	line-height: 52px;
	        	text-align: center;
	        	font-size: 16px;
	        	color:#ffffff;
	        	background-color: #4EAA5C
	        }
	        a:active {
	        	background-color: #368d44;
	        }
	        .ui-loading-block {
			    position: fixed;
			    top: 0;
			    left: 0;
			    width: 100%;
			    height: 100%;
			    z-index: 9999;
			    display: -webkit-box;
			    -webkit-box-orient: horizontal;
			    -webkit-box-pack: center;
			    -webkit-box-align: center;
			    background: rgba(0,0,0,.4);
			    display: none;
			    background: transparent;
			}
			.ui-loading-block .ui-loading-cnt {
			    width: 130px;
			    height: 110px;
			    display: -webkit-box;
			    -webkit-box-orient: vertical;
			    -webkit-box-align: center;
			    text-align: center;
			    background: rgba(0,0,0,.65);
			    border-radius: 6px;
			    color: #fff;
			    font-size: 16px;
			}   
			em, i {
			    font-style: normal;
			}
			.ui-loading-block .ui-loading-bright {
			    margin: 18px 0 8px;
			}
			.ui-loading-bright {
			    width: 37px;
			    height: 37px;
			    display: block;
			    background-image: url(/Public/img/loading_sprite_white.png);
			    -webkit-background-size: auto 37px;
			    -webkit-animation: am-rotate2 1s steps(12) infinite;
			}
			@-webkit-keyframes am-rotate2{
				from{background-position:0 0}to{background-position:-444px 0}
			}
			.toast {
				position: fixed;
			    top: 0;
			    left: 0;
			    width: 100%;
			    height: 100%;
			    z-index: 9999;
			    display: -webkit-box;
			    -webkit-box-orient: horizontal;
			    -webkit-box-pack: center;
			    -webkit-box-align: center;
			    background: rgba(0,0,0,.4);
			    display: none;
			    background: transparent;
			}
			.weui-toast {
				width: 130px;
			    height: 110px;
			    display: -webkit-box;
			    -webkit-box-orient: vertical;
			    -webkit-box-align: center;
			    text-align: center;
			    background: rgba(0,0,0,.65);
			    border-radius: 6px;
			    color: #fff;
			    font-size: 16px;
			}
			.weui-icon_toast {
				width: 50px;
			    height: 50px;
			    margin: 18px 0 8px;
			    display: block;
			}
			.weui-icon-success-no-circle {
			    font-size: 33px;
			    color: #09BB07;
			}
			.weui-toast__content {
			    margin: 0 0 5px;
			}
			
		</style>
	</head>
	<body>
		<!--<?php
			$uid = $_GET{'uid'};
		?>-->
		
		<div class="main">
			<div class="form">
				<form id ='resetpwd-form' action="{:U('resetpwd_post')}"  method="post">
					<!--<input type="hidden" name="uid" id="uid" value="$uid" />-->
					<div class="form-item">
						<label for="L_nowpass" class="form-label"><if condition="LANG_SET eq 'zh-cn'">原密码<else/>Old Pwd</if><span style='color:red;margin-left: 5px;'>*</span></label>
						<div class="input-inline">
							<input type="password" id="L_nowpass" name="oldpwd" required lay-verify="required" autocomplete="off" class="input">
						</div>
					</div>
					<div class="form-item">
						<label for="L_pass" class="form-label"><if condition="LANG_SET eq 'zh-cn'">新密码<else/>New Pwd</if><span style='color:red;margin-left: 5px;'>*</span></label>
						<div class="input-inline">
							<input type="password" id="L_pass" name="pwd" required lay-verify="required" autocomplete="off" class="input">
							
							<div class="form-mid word-aux">
							<if condition="LANG_SET eq 'zh-cn'">密码长度建议6到16位
								<else/>suggest password length is 6~16 </if>
							</div>
						</div>
					</div>
					<div class="form-item">
						<label for="L_repass" class="form-label"><if condition="LANG_SET eq 'zh-cn'">重输密码<else/>Pwd Again</if><span style='color:red;margin-left: 5px;'>*</span></label>
						<div class="input-inline">
							<input type="password" id="L_repass" name="repwd" required lay-verify="required" autocomplete="off" class="input">
						</div>
					</div>
					
					<div class="form-item" id="btn">
						<a class="btn" id="submit" href="javascript:void(0)">更改</a>
						<!--<button class="btn" key="set-mine" lay-filter="*" lay-submit >{:L('submit')}</button>-->
					</div>
				</form>
			</div>
		</div>
		<div class="ui-loading-block show">
	            <div class="ui-loading-cnt">
	                <i class="ui-loading-bright"></i>
	                <p>正在提交中...</p>
	            </div>
	        </div>
	        
	        <div class="toast">
		        <div class="weui-toast">
		            <i class="weui-icon-success-no-circle weui-icon_toast">√</i>
		            <p class="weui-toast__content">已完成</p>
		        </div>
	        </div>
		<js href="/Public/jquery.min.js" />
		<script>
			$(function(){
				resetpwd_submit();
				
				function resetpwd_submit() {
					$('#submit').click(function(){
						var r=confirm("确定修改密码？");
						if(r == true){
							$('.ui-loading-block').attr('style','display:-webkit-box;display:box');
							$.ajax({
			                    url:"{:U('resetpwd_post')}",
			                    data:$('#resetpwd-form').serialize(),
			                    type: "POST",
			                    dataType:"json",
			                    success: function(ret){
			                    	$('.ui-loading-block').hide();
			                        if(ret.status){
										if ($('.toast').css('display') != 'none') return;
										$('.toast').attr('style','display:-webkit-box;display:box');
										setTimeout(function() {
											$('.toast').hide();
											location.reload();
										},2000);
			                        } else {
			                      		alert(ret.info);
			                      		if (ret.info == "原密码不能为空" || ret.info == "原密码不匹配") {
			                      			$('input[name="oldpwd"]').focus();
	//			                      			$('input[name="oldpwd"]').parent().prev().attr('style','color:red');
			                      		}else if (ret.info == "新密码不能为空") {
			                      			$('input[name="pwd"]').focus();
			                      		}else if (ret.info == "重输密码不一致") {
			                      			$('input[name="repwd"]').focus();
			                      		}
			                      		
			                        }
			                    }
			                    
			               });
			            }
					});
				}
				
			});
		</script>
	</body>
</html>
